#include "visualizadorListaCircularDuplaLigada.h"
#include "f_ListaCircularDuplamenteLigada.h"
//------------------------------------------------------------------------------
visualizadorListaCircularDuplaLigada::visualizadorListaCircularDuplaLigada(float x,float y):visualizadorAbstrato(x,y)
{
	lstLCDL = new ListaCDL;
};
//------------------------------------------------------------------------------
visualizadorListaCircularDuplaLigada::~visualizadorListaCircularDuplaLigada()
{
	delete lstLCDL;
	lstLCDL = NULL;
};
//------------------------------------------------------------------------------
void visualizadorListaCircularDuplaLigada::desenha(TImage *area,double escalaX,double escalaY)const
{
	area->Canvas->Brush->Color = clPurple;
	area->Canvas->Rectangle((getX())*escalaX,(getY())*escalaY,(getX()+44)*escalaX,(getY()+44)*escalaY);
	if (escalaX == 1)
	{
		area->Canvas->Brush->Color = clWhite;
		area->Canvas->Rectangle((getX()+2)*escalaX,(getY()+6)*escalaY,(getX()+25)*escalaX,(getY()+37)*escalaY);
		area->Canvas->Brush->Color = clPurple;
		area->Canvas->TextOutA((getX()+27)*escalaX,(getY()+14)*escalaY,"x2");

		//linhas da lista
		area->Canvas->MoveTo(getX()+5,getY()+10);
		area->Canvas->LineTo(getX()+20,getY()+10);
		area->Canvas->MoveTo(getX()+5,getY()+13);
		area->Canvas->LineTo(getX()+20,getY()+13);
		area->Canvas->MoveTo(getX()+5,getY()+16);
		area->Canvas->LineTo(getX()+20,getY()+16);
		area->Canvas->MoveTo(getX()+5,getY()+19);
		area->Canvas->LineTo(getX()+20,getY()+19);
		area->Canvas->MoveTo(getX()+5,getY()+22);
		area->Canvas->LineTo(getX()+20,getY()+22);
		area->Canvas->MoveTo(getX()+5,getY()+25);
		area->Canvas->LineTo(getX()+20,getY()+25);

		//bolinha
		area->Canvas->Ellipse((getX()+27)*escalaX,(getY()+06)*escalaY,(getX()+37)*escalaX,(getY()+17)*escalaY);
		//texto
		area->Canvas->Brush->Color = clWhite;
		area->Canvas->TextOutA((getX()+6)*escalaX,(getY()+29)*escalaY,"LCDL" +IntToStr(getIdentidade()));
	}
};
//------------------------------------------------------------------------------
void visualizadorListaCircularDuplaLigada::interage()
{
	TfrmListaCircularDuplamenteLigada *frmLCDL = new TfrmListaCircularDuplamenteLigada(Application, lstLCDL);
	frmLCDL->ShowModal();
	delete(frmLCDL);
	frmLCDL = NULL;
};
//------------------------------------------------------------------------------


